package com.ruoyi.anno;

/**
 * <p>
 *  自定义响应结果
 * </p>
 *
 * @author 福隆苑居士，公众号：【Java分享客栈】
 * @since 2022-02-08
 */
public class ResultEntity<T> {

    private String status;

    private String msg;

    private T data;

    public ResultEntity(){}

    public ResultEntity(String status, String msg){
        this.status = status;
        this.msg = msg;
    }

    public ResultEntity(String status, String msg, T data){
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static ResultEntity fail(String code, String msg) {
        return new ResultEntity(code, msg);
    }

    public static <T> ResultEntity fail(String code, String msg, T data) {
        return new ResultEntity(code, msg, data);
    }

    public static ResultEntity ok(String code, String msg) {
        return new ResultEntity(code, msg);
    }

    public static <T> ResultEntity ok(String code, String msg, T data) {
        return new ResultEntity(code, msg, data);
    }
}
